﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pg.BioMedics.SDR.Services.Thesaurus
{
    /// <summary>
    /// Describes single meaning from thesaurus
    /// </summary>
    [Serializable]
    internal class Meaning
    {
        #region Constants

        private const char Separator = '|';

        #endregion

        #region Constructor

        /// <summary>
        /// Creates mening entry by parsing meaning line from thesaurus
        /// </summary>
        /// <param name="line">meninig line</param>
        internal Meaning(string line)
        {
            string[] components = line.Split(Separator);

            PartOfSpeech = components.First();
            Synonyms = new string[components.Length - 1];

            for (int i = 0; i < components.Length - 1; i++)
                Synonyms[i] = components[i + 1];
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets / sets part of speech described by this meaning
        /// </summary>
        internal string PartOfSpeech
        {
            get;
            set;
        }

        /// <summary>
        /// Gets / sets synonyms attached to this meaning
        /// </summary>
        internal string[] Synonyms
        {
            get;
            set;
        }

        #endregion
    }
}
